package com.example.goods_manage.controller;

import com.example.goods_manage.dto.User;
import com.example.goods_manage.service.UserService;
import com.example.goods_manage.utils.AjaxResult;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <P> @Author: SongKeCheng
 * <P> Type: Class
 * <P> Description:
 * <P> Date: 2024/6/20:18:42
 */

@SuppressWarnings({"unchecked", ""})
@RequestMapping("/user")
@RestController
public class UserController {
    private static final Logger log = LoggerFactory.getLogger(UserController.class);


    @Autowired
    private UserService userService;

    @PostMapping("/login")
    public AjaxResult login(@RequestBody User user){
        return userService.login(user);
    }

    @PostMapping("/register")
    public AjaxResult register(@RequestBody User user){
        return userService.register(user);
    }
}
